import { createRouter, createWebHashHistory } from 'vue-router'
import Laout from '@/views/Layout'
import Cart from '@/views/cart'
import Category from '@/views/category'
import Checkout from '@/views/checkout'
import Home from '@/views/home'
import Login from '@/views/login'
import pay from '@/views/pay'
import product from '@/views/product'
import result from '@/views/result'

const routes = [
  {
    path: '/login',
    component: Login
  },
  {
    path: '/',
    component: Laout,
    children: [
      {
        path: 'Cart',
        component: Cart
      },
      {
        name: 'category',
        path: 'Category/:id',
        component: Category
      },
      {
        path: 'Checkout',
        component: Checkout
      },
      {
        path: 'Home',
        component: Home
      },
      {
        path: 'pay',
        component: pay
      },
      {
        name: 'product',
        path: 'product/:id',
        component: product
      }, {
        path: 'result',
        component: result
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
